gfg bit difference problem in python